<?php include('functions.php'); ?>
<html>
<head>
<title>oPanel V<?php echo $ver; ?></title>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet"href="style.css">
</head>
<body>
<?php
if(!isset($_POST['newdir'])) {
$dir = $_GET['dir']; // lets find the file we are talking about
$real_dir = realpath("$dir");
echo "<b>Create a directory in&nbsp;";
echo "<i>$real_dir".DIRECTORY_SEPARATOR."</i></b>";
echo '<form method="POST" action="makedir.php" >
<input type="text" name="newdir">
<input type="submit" value="Create">';
echo "<input type=\"hidden\" name=\"dir\" value=\"$dir\">";
echo "</form>";
} else {
$newdir = $_POST['newdir']; // the new files name
$dir1 = $_POST['dir'];
$dir = stripslashes("$dir1");
$location = realpath("$dir");
$newdir = "$location".DIRECTORY_SEPARATOR."$newdir";
                             #-----------------------------------------------------------#
                             # this code check if directory is Already EXISTS.      #
                             #-----------------------------------------------------------#
                             if(file_exists($newdir)){
                                 echo "<img src=\"images/i-directory.gif\"> <b>Creation of $newdir failed because File exists</b> in <i>$location</i>";
                             }else{
mkdir("$newdir");
echo "<img src=\"images/i-directory.gif\"> <b>Created $newdir</b> in <i>$location</i>";
}
?>
<script type="text/javascript">
parent.filemain.location="http://<?php echo $_SERVER["HTTP_HOST"]; echo dirname("$_SERVER[SCRIPT_NAME]"); ?>".DIRECTORY_SEPARATOR."list.php?dir=<?php echo $dir; ?>";
</script>
<?php
}
?>
</font> 
</body>
</html>